<template>
	<view class="box-detail">
		<view class="item-index-top">
			<view class="item-top-text">中介机构合同</view>
		</view>
		<view class="box-detail-content">
			<view class="box-detail-content-item">
				<view class="row-title">中介机构名称</view>
				<input class="uni-input form-input" v-model="formData.ORG_value"  name="input" @click="showSinglePicker()"  placeholder="请填写中介机构" disabled=""/>
				<!-- <view class="row-content">{{pageData.model.ORG_value||"无"}}</view> -->
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">合同签署时间</view>
				<uni-datetime-picker class="form-picker" type="date" :value="formData.SIGN_TIME_ORG" start="2000-2-31" end="2050-12-30" @change="dateChange"></uni-datetime-picker>
				<!-- <view class="row-content">{{pageData.model.SIGN_TIME_ORG||"无"}}</view> -->
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">合同编号</view>
				<input class="uni-input min-form-input" v-model="formData.CONTRACT_CODE_ORG" name="input" placeholder="请填写合同编号"/>
				<!-- <view class="row-content">{{pageData.model.CONTRACT_CODE_ORG||"无"}}</view> -->
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">备注</view>
				<textarea class="uni-input min-form-input" v-model="formData.REMARK_ORG" name="input" placeholder="请填写备注"/>
				<!-- <view class="row-content">{{pageData.model.REMARK_ORG||"无"}}</view> -->
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">已签署合同附件</view>
				<view class="box-attach-row" >
					<image src="../../../../static/images/icon_enclosure.png" mode="widthFix" class="box-attach-icon">
					</image>
					<text class="box-attach-name" @click="uploadFiles('ZJHTFJ')">点击上传</text>
				</view>
			</view>
			<view class="box-detail-content-item" v-for="item,index in  getFilesList" :key="index">
				<view class="row-title"></view>
				<view class="row-content box-attach-row">
					<image src="../../../../static/images/icon_enclosure.png" mode="" class="box-attach-icon"></image>
					<text class="box-attach-name">{{ item.fileShowName||"无"}}</text>
				</view>
			</view>
		</view>
		<new-file ref="child" :pageData="pageData" :fileType='fileType'/>
		<mpvue-picker :themeColor="themeColor" ref="mpvuePicker1" :mode="mode" :deepLength="deepLength" :pickerValueDefault="pickerValueDefault"
		 @onConfirm="onConfirm1" @onCancel="onCancel" :pickerValueArray="pickerValueArray"></mpvue-picker>
	</view>
</template>

<script>
	import newFile from './new_file.vue'
	import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';
	export default {
		components: {
		    mpvuePicker,
			newFile
		},
		data(){
			return{
				themeColor: '#007AFF',
				mode: '',
				deepLength: 1,
				pickerValueDefault: [3],
				pickerValueArray:[],
				code:'',
				formData:{},
				fileListData:{},
				fileType:''
			}
		},
		props: {
			pageData: {
				type: Object,
				default(){
					return {}
				}
			},
			changeListData:{
				type: Object,
				default(){
					return {}
				}
			}
		},
		watch:{
			pageData(){
				if(this.pageData.model){
					if(this.pageData.docJsonData['PPP_T_BUS_PROJ.ZJHTFJ']&&this.pageData.docJsonData['PPP_T_BUS_PROJ.ZJHTFJ'].fileList.length){
						this.getFilesList=this.pageData.docJsonData['PPP_T_BUS_PROJ.ZJHTFJ'].fileList
					}else{
						this.getFilesList=[]
					}
					this.formData={
						ORG:this.pageData.model.ORG,//中介机构名称
						ORG_value:this.pageData.ORG_value,
						SIGN_TIME_ORG:this.pageData.model.SIGN_TIME_ORG,//合同签署时间
						CONTRACT_CODE_ORG:this.pageData.model.CONTRACT_CODE_ORG,//合同编号
						REMARK_ORG:this.pageData.model.REMARK_ORG,//注册资本
					}
				}
			}
		},
		methods:{
			showSinglePicker() {
				let dataArry=[]
				this.pickerValueArray=[]
				if(this.changeListData.zhongjieList){
					dataArry=this.changeListData.zhongjieList
					 this.$refs.mpvuePicker1.show()
				}
				dataArry.map(item=>{
					this.pickerValueArray.push(
						{
							label: item.CODE_NAME,
							value: item.CODE
						}
					)
				})
				this.mode = 'selector'
				this.deepLength = 1
				this.pickerValueDefault = [0]
				
			},
			onCancel(e) {
			    console.log(e)
			},
			onConfirm1(e) {
				if(this.formData){
					this.formData.ORG_value=e.label
					this.formData.ORG=e.value[0]
				}
			},
			dateChange(e) {
				this.date = e
				this.formData.SIGN_TIME_ORG=e 
			},
			uploadFiles(name){
				this.fileType=name
				this.$refs.child.popOpen()
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.wrap{
		padding-bottom: 60rpx;
	}
	page{
		padding-bottom: 20rpx;
	}
	.box-detail {
		min-height: 760rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		margin: 20rpx;
		padding: 26rpx 30rpx 50rpx 30rpx;
	}
	.item-index-top{
		// width: 650rpx;
		height: 40rpx;
		// margin: 20rpx 20rpx 18rpx 20rpx;
		background-color: #0099cc;
		border-radius: 10rpx;
		.item-top-text{
			font-family: AlibabaPuHuiTi-Regular;
			padding-left: 20rpx;
			font-size: 26rpx;
			font-weight: normal;
			line-height: 40rpx;
			letter-spacing: 0px;
			color: #ffffff;
		}
	}
	.item-top{
		display: flex;
		justify-content: space-between;
		.setion-left{
			display: flex;
			flex-direction: column;
			.left-text-top{
				font-size: 30rpx;
				font-weight: 600;
				color: #414a5d;
			}
			.left-text-bot{
				margin-top: 22rpx;
				font-size: 26rpx;
				color: #7f7f7f;
			}
		}
		.setion-right{
			display: flex;
			flex-direction: column;
			align-items: flex-end;
			.right-text-top{
				height: 30rpx;
				line-height: 30rpx;
				font-size: 26rpx;
				font-weight: normal;
				color: #9a9a9a;
			}
			.right-text-bot{
				margin-top: 22rpx;
				font-size: 28rpx;
				font-weight: normal;
				color: #999999;
			}
		}
	}
	.box-detail-header {
		display: flex;
		justify-content: space-between;
		margin-bottom: 8rpx;
	
		.name {
			font-size: 30rpx;
			color: #414a5d;
			font-weight: bold;
		}
	
		.date {
			font-size: 26rpx;
			color: #9a9a9a;
		}
	}
	
	.box-net {
		font-size: 26rpx;
		color: #0099cc;
	}
	
	.box-detail-content {
		margin-top: 24rpx;
		padding: 0 10rpx;
		// border-bottom: 8rpx solid #e8f0f2;
		
	}
	// .border {
	// 	;
	// }
	.border-wid{
		border-bottom: 0
	}
	.box-detail-content-item {
		display: flex;
		flex-direction: row;
		// justify-content: flex-start;
		// justify-content: space-between;
		margin-bottom: 20rpx;
	
		.row-title {
			width: 190rpx;
			font-size: 26rpx;
			color: #9a9a9a;
			text-align: left;
			flex-shrink: 0;
			margin-right: 10rpx;
	
			&.mag {
				margin-left: 18rpx;
			}
		}
	
		.row-content {
			font-size: 26rpx;
			color: #414a5d;
			word-wrap: break-word;
			word-break: break-all;
			flex: 1;
			text-align: left;
	
			&.mag {
				margin-right: 18rpx;
			}
		}
	}
	
	.bar-contact {
		background-color: #0099cc;
		border-radius: 10px;
		height: 40rpx;
		line-height: 40rpx;
		padding-left: 18rpx;
		color: #FFFFFF;
		font-size: 24rpx;
		
	}
	.box-attach{
		margin-top: 20rpx;
		padding-top: 20rpx;
		// padding: 0 10rpx;
		border-top: 1px solid #e8f0f2;
	}
	.box-attach-row {
		display: flex;
		flex: 1;
		align-items: center;
		// padding: 0 18rpx;
		// height: 38rpx;
		margin-bottom: 10rpx;
		.box-attach-icon {
			width: 34rpx;
			height: 40rpx;
			margin-right: 30rpx;
		}
		.box-attach-name {
			flex: 1;
			font-size: 26rpx;
			color: #0099cc;
		}
	}
	.fixed-action-bar{
		width: 100%;
		display: flex;
		height: 70rpx;
		align-items: center;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 999;
		.item{
			width: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			
		}
		.icon{
			width: 30rpx;
		}
		.btn-box{
			width: 90rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70rpx;
		}
		.text-edit{
			font-size: 24rpx;
			color: #0099cc;
			line-height: 70rpx;
		}
		.text-delete{
			font-size: 24rpx;
			color: #cc3357;
			line-height: 70rpx;
		}
	}
	.box-attach-row {
		display: flex;
		align-items: center;
		padding: 0 18rpx;
		// height: 38rpx;
		margin-bottom: 10rpx;
		.box-attach-icon {
			width: 34rpx;
			margin-right: 30rpx;
		}
		.box-attach-name {
			font-size: 26rpx;
			color: #0099cc;
		}
	}
	.uni-input{
		font-size: 26rpx;
		color: #808080;
		// border-bottom:1px solid #dce4e6;
		flex:1;
	}
	.form-picker {
		width: 250rpx;
	}
</style>
